<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>滴答办公系统-员工批量</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="media/layui/css/layui.css" media="all">
<script src="media/js/jquery.min.js"></script>
</head>
<body>
	<div class="layui-container" style="margin-top: 5px">
		<form class="layui-form" action="staffbatch.do" method="post" enctype="multipart/form-data">
		<div class="layui-form-item">
				<label class="layui-form-label">下载模板</label>
				<div class="layui-input-block">
					<a href="media/tem/stafftem.xls">批量导入员工模板.xls</a>
				</div>
				
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">选择文件</label>
				<div class="layui-input-block">
					<input type="file" name="mFile" id="no1" class="layui-input">
				</div>
			</div>
		<div class="layui-form-item">
				<input class="layui-btn" style="margin-left: 10%"  id="btn1" type="submit" value="确认导入">
			</div>
		
		</form>
	</div>
	<script src="media/layui/layui.js"></script>
	<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>
	layui.use('table', function(){
		  var table = layui.table;
		  
		  //第一个实例
		  table.render({
		    elem: '#tbdata'
		    ,url: 'staffpage.do' //数据接口
		    ,page: true //开启分页
		    ,cols: [[ //表头
		      {field: 'no', title: '工号', sort: true, fixed: 'left'}
		      ,{field: 'name', title: '员工名称'}
		      ,{field: 'dname', title: '所属部门'}
		      ,{field: 'sex', title: '性别'}
		      ,{field: 'phone', title: '手机号'}
		      ,{field: 'qq', title: 'qq号'}
		      ,{field: 'email', title: '邮箱'}
		      ,{field: 'createdate', title: '入职日期'}
		      ,{field:'right', title: '操作',toolbar:"#barop"}
		    ]]
		  });
		  //监听工具条
		  table.on('tool(tbop)', function(obj){
		        var data = obj.data;
		        if(obj.event === 'del'){
		            layer.confirm('是否确认删除员工?', function(index){
		                $.ajax({
		                    url: "staffdelete.do",
		                    type: "POST",
		                    data:"no="+data.no,
		                    success: function(data){
		                        if(data.code==1000){
		                            obj.del();//删除表格中的对应行数据
		                            layer.close(index);
		                            layer.msg("删除成功", {icon: 6});
		                        }else{
		                            layer.msg("删除失败", {icon: 5});
		                        }
		                    }
		                });
		            });
		        } else if(obj.event === 'edit'){//编辑 修改
		           location.href="staffupdate.html?d="+ encodeURI(JSON.stringify(data));
		        }
		});
	});

</script>
</body>
</html>